package com.xinchao.controller;

import com.xinchao.core.constant.ResponseConstant;
import com.xinchao.model.BreakdownType;
import com.xinchao.model.sys.JsonResponse;
import com.xinchao.service.BreakdownTypeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 终端故障类型
 *
 * @author linqiang
 * @date 2018-08-08 15:37
 */
@Controller
@RequestMapping(value = "/breakdownType")
public class BreakdownTypeController {
    private Logger logger = LoggerFactory.getLogger(BreakdownTypeController.class);
    @Autowired
    private BreakdownTypeService breakdownTypeService;

    /**
     * 获取终端故障类型下拉集合
     *
     * @return Object
     */
    @ResponseBody
    @RequestMapping(value = "/selectList")
    public Object selectList() {
        try {
            List<BreakdownType> breakdownTypeList = breakdownTypeService.selectList();
            return new JsonResponse(ResponseConstant.CODE_SUCCESS, breakdownTypeList, "获取终端故障类型下拉集合成功");
        } catch (Exception e) {
            logger.error("DeviceModelController selectList 获取终端故障类型下拉集合失败：" + e.getMessage());
        }
        return new JsonResponse(ResponseConstant.CODE_FAIL, "获取终端故障类型下拉集合失败");
    }
}
